//package com.zmn.plat.dubbo.impl.product;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import javax.annotation.Resource;
//
//import org.apache.dubbo.config.annotation.Service;
//import org.springframework.cglib.beans.BeanCopier;
//
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.common.utils.number.NumberUtil;
//import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
//import com.zmn.plat.common.dictionary.PlatErrorCodeDict;
//import com.zmn.plat.common.dto.product.ServSubsidiaryGroupDIO;
//import com.zmn.plat.common.dto.product.ServSubsidiaryGroupDRO;
//import com.zmn.plat.dubbo.interfaces.product.ServSubsidiaryGroupListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.product.ServSubsidiaryGroup;
//import com.zmn.plat.model.entity.product.ServSubsidiaryGroupQuery;
//import com.zmn.plat.services.interfaces.product.ServSubsidiaryGroupService;
//import com.zmn.plat.utils.bean.BeanCopyUtils;
//
//import lombok.extern.slf4j.Slf4j;
//
///**
// * @author tanghongjun
// * @version v1.0 @类说明：
// * @since 2018/10/16 11:30
// */
//@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
//@Slf4j
//public class ServSubsidiaryGroupListRemoteServiceImpl implements ServSubsidiaryGroupListRemoteService {
//
//    private static final String TAG = "故障服务分组 dubbo 接口";
//
//    @Resource
//    private ServSubsidiaryGroupService servSubsidiaryGroupService;
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<ServSubsidiaryGroupDRO> getById(Integer groupId) {
//        log.info("ServSubsidiaryGroupDRO param is:groupId={}", groupId);
//
//        if (NumberUtil.isNullOrZero(groupId)) {
//            log.error(String.format("[%s]参数:[%s]不能为空", TAG, "groupId"));
//            return ResponseDTO.fromErrorCodeTable(PlatErrorCodeDict.ERROR_CODE_PANAM_NULL);
//        }
//
//        ServSubsidiaryGroup servSubsidiaryGroup = servSubsidiaryGroupService.findByKey(groupId);
//        ServSubsidiaryGroupDRO servSubsidiaryGroupDRO = new ServSubsidiaryGroupDRO();
//        BeanCopyUtils.copyProperties(servSubsidiaryGroup, servSubsidiaryGroupDRO);
//
//        return ResponseDTO.success(servSubsidiaryGroupDRO, "OK");
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ServSubsidiaryGroupDRO>> listByDIO(ServSubsidiaryGroupDIO servSubsidiaryGroupDIO) {
//        log.info("listByDIO param is:servSubsidiaryGroupDIO={}", servSubsidiaryGroupDIO);
//        ServSubsidiaryGroupQuery query = new ServSubsidiaryGroupQuery();
//        BeanCopyUtils.copyProperties(servSubsidiaryGroupDIO, query);
//
//        List<ServSubsidiaryGroup> servSubsidiaryGroupList = servSubsidiaryGroupService.listByQuery(query);
//
//        return this.listToDRO(servSubsidiaryGroupList);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ServSubsidiaryGroupDRO>> listAll() {
//        List<ServSubsidiaryGroup> servSubsidiaryGroupList = servSubsidiaryGroupService.listAll();
//
//        return this.listToDRO(servSubsidiaryGroupList);
//    }
//
//    private ResponseDTO<List<ServSubsidiaryGroupDRO>> listToDRO(List<ServSubsidiaryGroup> servSubsidiaryGroupList) {
//        List<ServSubsidiaryGroupDRO> items = new ArrayList<>();
//        ServSubsidiaryGroupDRO servSubsidiaryGroupDRO;
//        BeanCopier copier = BeanCopier.create(ServSubsidiaryGroup.class, ServSubsidiaryGroupDRO.class, false);
//        for (int i = 0; i < servSubsidiaryGroupList.size(); i++) {
//            servSubsidiaryGroupDRO = new ServSubsidiaryGroupDRO();
//            copier.copy(servSubsidiaryGroupList.get(i), servSubsidiaryGroupDRO, null);
//            items.add(servSubsidiaryGroupDRO);
//        }
//
//        return ResponseDTO.success(items);
//    }
//
//}
